package com.aizhixin.lab.course.course.repository;

import com.aizhixin.lab.course.course.entity.CourseAssist;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface CourseAssistRepository extends JpaRepository<CourseAssist, Long> {

    Page<CourseAssist> findByCourseIdAndDeleteFlagAndParentIdIsNull(Pageable pageable, String courseId, Integer deleteFlag);

    List<CourseAssist> findByCourseIdAndDeleteFlagAndParentIdIsNull(String courseId, Integer deleteFlag);

    Page<CourseAssist> findByCourseIdAndDeleteFlagAndIsHideAndParentIdIsNull(Pageable pageable, String courseId, Integer deleteFlag, Boolean isHide);

    Page<CourseAssist> findByCourseIdAndParentIdAndDeleteFlag(Pageable pageable, String courseId, Long parentId, Integer deleteFlag);

    Page<CourseAssist> findByCourseIdAndParentIdAndDeleteFlagAndIsHide(Pageable pageable, String courseId, Long parentId, Integer deleteFlag, Boolean isHide);

    List<CourseAssist> findByParentId(Long parentId);
    CourseAssist findById(Long id);
    Integer countByDeleteFlag(Integer deleteFlag);

    CourseAssist findByIdAndDeleteFlag(Long id, Integer deleteFlag);
}
